<template>
  <a-card :bordered="false">
    <div class="table-page-search-wrapper">
      <div class="roder-details">
        <a-tabs default-active-key="1">
          <a-tab-pane key="1" tab="订单基本信息">
            <div class="info">
              <h3 class="title">订单信息</h3>
              <a-button type="primary" style="margin-bottom:10px" @click="download($route.query.order)">下载量体表</a-button>
              <div class="list">
                <div class="list-div">

                  <div>
                    <p>门店名称</p>
                    <span>{{ orderDetail.storeName }}</span>
                  </div>

                  <div>
                    <p>下单员工</p>
                    <span>{{ orderDetail.empName }}</span>
                  </div>

                  <div>
                    <p>员工电话</p>
                    <span>{{ orderDetail.empPhone }}</span>
                  </div>

                  <div>
                    <p>订单编号</p>
                    <span>{{ orderDetail.orderSn }}</span>
                  </div>
                  <div>
                    <p>客户编号</p>
                    <span>{{ orderDetail.storeCode }}</span>
                  </div>
                  <div>
                    <p>创建时间</p>
                    <span>{{ orderDetail.createTime }}</span>
                  </div>

                  <div v-if="orderDetail.payTime!='' && orderDetail.payTime!=null">
                    <p>支付时间</p>
                    <span>{{ orderDetail.payTime }}</span>
                  </div>

                  <div>
                    <p>订单金额</p>
                    <span>{{ orderDetail.orderMoney }}元</span>
                  </div>
                  <div>
                    <p>订单状态</p>
                    <span v-if="orderDetail.status=='11'">未付款</span>
                    <span v-if="orderDetail.status=='1'">已支付</span>
                    <span v-if="orderDetail.status=='2'">已提交</span>
                    <span v-if="orderDetail.status=='3'">已接单</span>
                    <span v-if="orderDetail.status=='4'">等待面料</span>
                    <span v-if="orderDetail.status=='5'">剪裁</span>
                    <span v-if="orderDetail.status=='6'">缝制</span>
                    <span v-if="orderDetail.status=='7'">发货</span>
                    <span v-if="orderDetail.status=='8'">订单完成</span>
                    <span v-if="orderDetail.status=='9'">售后</span>
                    <span v-if="orderDetail.status=='10'">驳回</span>
                  </div>
                </div>

              </div>
              <h3 class="title">基本信息</h3>
              <div class="list">
                <div class="list-div">
                  <div>
                    <p>顾客订单编号</p>
                    <span>{{ orderDetail.customerCode }}</span>
                  </div>
                  <!-- <div>
                     <p>面料来源</p>
                     <span>{{orderDetail.fabricSource}}</span>
                   </div>-->
                  <div>
                    <p>快递方式</p>
                    <!--<span>{{orderDetail.courierName}}</span>-->
                    <span v-if="orderDetail.courierId=='1'">顺丰快递</span>
                    <span v-if="orderDetail.courierId=='2'">申通快递</span>
                    <span v-if="orderDetail.courierId=='3'">中通快递</span>
                    <span v-if="orderDetail.courierId=='4'">德邦快递</span>
                  </div>

                  <div>
                    <p>顾客性别</p>
                    <span>{{ orderDetail.customerSex }}</span>
                  </div>
                  <div>
                    <p>业务来源</p>
                    <span>{{ orderDetail.businessSource }}</span>
                  </div>
                  <div>
                    <p>地址</p>
                    <span>{{ orderDetail.address }}</span>
                  </div>
                  <div>
                    <p>顾客姓名</p>
                    <span>{{ orderDetail.customerName }}</span>
                  </div>
                  <div>
                    <p>包装方式</p>
                    <span>{{ orderDetail.packageType }}</span>
                  </div>
                </div>
              </div>

              <!--接下来都是跟着产品走的数据，遍历每一个产品-->
              <div v-for="(item,key) in orderDetail.productInfoList" :key="item.id">
                <h3 class="title">{{ item.productName }}</h3>
                <h3 class="title">品类版型</h3>
                <div class="list">
                  <div class="list-div">
                    <div>
                      <p>顾客性别</p>
                      <span v-if="item.sex=='0'">男性</span>
                      <span v-if="item.sex=='1'">女性</span>
                    </div>
                    <div v-for="(pl,key) in item.plbx" :key="pl.id">
                      <p>{{ pl.smallTemplateName }}</p>
                      <span>{{ pl.categoryName }}</span>
                    </div>
                  </div>
                </div>

                <!--              <h3 class="title">面料辅料</h3>
                              <div class="list">
                                <div class="list-div">
                                  <div v-for="(fabric,key) in item.fabricList" :key="key.id">
                                    <p v-if="fabric.isMianFu=='0'">面料</p>
                                    <p v-if="fabric.isMianFu=='1'">里布</p>
                                    <p v-if="fabric.isMianFu=='2'">低领里</p>
                                    <span>{{ fabric.fabricName }}</span>
                                  </div>
                                </div>
                              </div>-->

                <h3 class="title">款式工艺</h3>
                <div class="list">
                  <div class="list-div">
                    <!--<div>
                        <p>品类</p>
                        <span>{{item.productName}}</span>
                    </div>
                    <div></div>
                    <div></div>-->
                    <div v-for="(ks,key) in item.ksgy" :key="key.id">
                      <p>{{ ks.smallTemplateName }}</p>
                      <span>{{ ks.categoryName }}</span>
                    </div>
                    <!--<div>
                        <p>外大袋</p>
                        <span>平袋无袋盖</span>
                    </div>-->
                  </div>
                </div>

                <h3 class="title">面料辅料</h3>
                <div class="list">
                  <div class="list-div">
                    <div>
                      <p>面料</p>
                      <span>{{ item.fabricCode }}</span>
                    </div>

                    <div>
                      <p>面料备注</p>
                      <span>{{ item.fabricRemark }}</span>
                    </div>

                    <div v-if="item.libuInfo!=null">
                      <p>里布</p>
                      <span>{{ item.libuInfo.libuCode }}</span>
                    </div>
                    <div v-if="item.dilinniInfo!=null">
                      <p>底领呢</p>
                      <span>{{ item.dilinniInfo.dilinniNumber }}</span>
                    </div>

                    <div v-for="(ks,key) in item.buttonsInfoList" :key="key.id">
                      <p>纽扣</p>
                      <span>{{ ks.buttonsCode }}</span>
                    </div>
                  </div>
                </div>

                <h3 class="title">绣字撞色</h3>
                <h4 class="title2">绣字</h4>
                <div class="list">
                  <div class="list-div">
                    <div v-if="item.xiuziType == '无绣字'">
                      <p>无绣字</p>
                    </div>
                    <div v-if="item.xiuziType != '无绣字' && item.xiuziType == '文字'">
                      <p>绣字一</p>
                      <span class="b">{{ item.xiuziOneNeirong }}</span>
                    </div>
                    <div v-if="item.xiuziType != '无绣字' && item.xiuziType == '文字'">
                      <p>绣字二</p>
                      <span class="b">{{ item.xiuziTwoNeirong }}</span>
                    </div>
                    <div v-if="item.xiuziType != '无绣字' && item.xiuziType == '文字'">
                      <p>绣字颜色</p>
                      <span v-if="item.xiuziColorEntity != null">{{ item.xiuziColorEntity.colorName }}</span>
                    </div>

                    <div v-if="item.xiuziType != '无绣字'">
                      <p>绣字部位</p>
                      <span>{{ item.xiuziWeizhi }}</span>
                    </div>
                    <div v-if="item.xiuziType != '无绣字' && item.xiuziType == '文字'">
                      <p>绣字字体</p>
                      <span v-if="item.font!=null">{{ item.font.embroideredName }}</span>
                    </div>
                    <div v-if="item.xiuziType != '无绣字' && item.xiuziType == '图片'">
                      <p>绣字图片</p>
                      <span>{{ item.xiuziImg }}</span>
                    </div>

                    <div v-if="!!item.zidingyiImg">
                      <p>自定义图片</p>
                      <img
                        style="width: 100px; height: 100px;margin-right:10px"
                        :src="item.zidingyiImg"
                        fit="fit"></img>
                    </div>
                    <div>
                    </div>
                  </div>
                </div>

                <h4 v-show="item.allConColor !=null &&item.allConColor.length>0" class="title2">撞色</h4>
                <div class="list">
                  <div class="list-div">
                    <div v-for="(zs,key) in item.allConColor" :key="zs.id">
                      <p>{{ zs.contrastColorName }}</p>
                      <span>{{ zs.colorName }}</span>
                    </div>
                  </div>
                </div>

                <h3 class="title">量体信息</h3>

                <h4 class="title2">成衣尺寸</h4>

                <div class="list" v-if="item.cheng==null">
                  <div class="list-div">
                    <div>
                      <p>暂无数据</p>
                    </div>
                  </div>
                </div>

                <div class="list" v-if="item.cheng!=null && item.cheng.length>0">
                  <div class="list-div">
                    <div v-for="(proSize,key) in item.cheng" :key="proSize.id">
                      <p>{{ proSize.sizeName }}</p>
                      <span>{{ proSize.bodysizeValue }}{{ proSize.unit }}</span>
                    </div>
                  </div>
                </div>

                <h4 class="title2">净体尺寸</h4>

                <div class="list" v-if="item.jing==null">
                  <div class="list-div">
                    <div>
                      <p>暂无数据</p>
                    </div>
                  </div>
                </div>

                <div class="list" v-if="item.jing!=null && item.jing.length>0">
                  <div class="list-div">
                    <div v-for="(proSize,key) in item.jing" :key="proSize.id">
                      <p>{{ proSize.sizeName }}</p>
                      <span>{{ proSize.bodysizeValue }}{{ proSize.unit }}</span>
                    </div>
                  </div>
                </div>

                <h4 class="title2">体型数据</h4>

                <div class="list" v-if="item.sizeInfoList==null">
                  <div class="list-div">
                    <div>
                      <p>暂无数据</p>
                    </div>
                  </div>
                </div>

                <!--有体型数据-->
                <div class="list" v-if="item.sizeInfoList!=null && item.sizeInfoList.length>0">
                  <div class="list-div">
                    <div v-for="(tx,key) in item.sizeInfoList" :key="tx.id">
                      <p>{{ tx.sizeName }}</p>
                      <span>{{ tx.size1 }}</span>
                    </div>
                  </div>
                </div>

                <h4 class="title2">量体备注</h4>

                <div class="list" v-if="item.liangtiRemark==null">
                  <div class="list-div">
                    <div>
                      <p>暂无数据</p>
                    </div>
                  </div>
                </div>

                <div v-if="item.liangtiRemark!=null">
                  <!--                  <div class="list-div">
                                      <div>
                                        <p>{{ item.liangtiRemark }}</p>
                                      </div>
                                    </div>-->
                  <p style="font-weight: bolder">{{ item.liangtiRemark }}</p>
                </div>

                <div v-show="false">
                  <!--量体图片-->
                  {{ item.liangtiImgs != null ? item.imglist = item.liangtiImgs.split(",") : item.imglist = [] }}
                </div>
                <div>
                  <img v-for="(oneimg,index3) in item.imglist"
                       style="width: 100px; height: 100px;margin-right:10px"
                       :src="oneimg"
                       fit="fit"></img>
                </div>

              </div>
              <!--遍历的数据结束-->

              <!--<h3 class="title">订单附加条件</h3>
              <div class="list">
                <div class="list-div">
                  <div>
                    <p>式样</p>
                    <span>{{orderDetail.shiyang}}</span>
                  </div>
                  <div>
                    <p>改款打样</p>
                    <span>{{orderDetail.modifiedYang}}</span>
                  </div>
                  <div>

                  </div>

                  <div>
                    <p>紧急指数</p>
                    <span>{{orderDetail.emergency}}</span>
                  </div>
                  <div>
                    <p>品牌标</p>
                    <span>{{orderDetail.brandLabel}}</span>
                  </div>

                </div>
              </div>-->


              <h3 class="title">订单费用明细</h3>
              <h3 class="title">面料费用</h3>
              <div class="table-css">
                <a-table class="table1" lign="center" :columns="fabriclist"
                         :data-source="orderDetail.allFabric"
                         :pagination="false">
                  <a slot="k7" slot-scope="text" style="color:#C49D18">{{ text }}</a>
                  <a slot="k6" slot-scope="text" style="color:#C49D18">{{ text }}</a>
                  <a slot="k8" slot-scope="text" style="color:#C49D18">{{ text }}</a>
                </a-table>
              </div>
              <h3 class="title">加工费用</h3>
              <div>
                <div class="table-css">
                  <a-table class="table1" lign="center" :columns="allprolist"
                           :data-source="orderDetail.productInfoList"
                           :pagination="false">
                    <a slot="k7" slot-scope="text" style="color:#C49D18">{{ text }}</a>
                    <a slot="k6" slot-scope="text" style="color:#C49D18">{{ text }}</a>
                    <a slot="k8" slot-scope="text" style="color:#C49D18">{{ text }}</a>
                  </a-table>
                </div>
              </div>

              <h3 class="title">加价项目</h3>
              <div>
                <div class="table-css">
                  <h3 class="title">绣字撞色加价</h3>
                  <a-table class="table1" lign="center" :columns="jiajia"
                           :data-source="jiajiaList"
                           :pagination="false">
                    <!--<a slot="k7" slot-scope="text" style="color:#C49D18">{{text}}</a>
                    <a slot="k6" slot-scope="text" style="color:#C49D18">{{text}}</a>
                    <a slot="k8" slot-scope="text" style="color:#C49D18">{{text}}</a>-->
                  </a-table>
                </div>
              </div>

              <!--            <h4 class="title2">收费服务</h4>-->
              <div>
                <div class="table-css">
                  <h3 class="title">辅料加价</h3>
                  <a-table class="table1" lign="center" :columns="fuwuFabricTitle"
                           :data-source="shouFeiList"
                           :pagination="false">
                  </a-table>
                </div>
              </div>

              <h3 class="title">收费服务</h3>
              <el-table :data="orderFujiaList" style="width: 100%" :border="true"
                        :header-cell-style="{'text-align':'center'}"
                        :cell-style="{'text-align':'center'}">

                <el-table-column label="序号" width="50">
                  <template slot-scope="scope">
                    {{ scope.$index + 1 }}
                  </template>
                </el-table-column>
                <el-table-column label="品类名称" prop="cateogryName"></el-table-column>
                <el-table-column label="产品名称" prop="productName"></el-table-column>
                <el-table-column label="收费项目" prop="costName"></el-table-column>
                <el-table-column label="金额(元)" prop="price"></el-table-column>
              </el-table>

              <h5 class="price">合计金额：<span>{{ orderDetail.orderMoney }}元</span></h5>
              <h5 v-if="orderDetail.priorPrice!=0" class="price">调价前金额：<span>{{ orderDetail.priorPrice }}元</span></h5>
              <h5 v-if="orderDetail.priorPrice!=0" class="price">原总金额：<span>{{ orderDetail.firstPrice }}元</span></h5>
              <h5 v-if="orderDetail.status>=1 && orderDetail.status<=10 && orderDetail.deductionPay!=0"
                  class="price">抵扣额度支付：<span>{{ orderDetail.deductionPay }} 元</span></h5>
              <h5 v-if="orderDetail.status>=1 && orderDetail.status<=10 && orderDetail.monthPay!=0"
                  class="price">月结剩余额度支付：<span>{{ orderDetail.monthPay }} 元</span></h5>
              <h5 v-if="orderDetail.status>=1 && orderDetail.status<=10 && orderDetail.balancePay!=0"
                  class="price">余额支付：<span>{{ orderDetail.balancePay }} 元</span></h5>
              <div class="btns">
                <div v-if="orderDetail.status=='11'" @click="visible = true" class="btn1">调价</div>
              </div>
              <h3 class="title">订单备注</h3>
              <textarea v-model="remark" class="text1" style="color: rgb(153, 153, 153);"></textarea>

              <div class="btns">
                <!--              <div class="btn1" @click="orderNow($route.query.order)" v-if="orderDetail.status=='1'">立即接单</div>-->
                <div @click="openDelWindow" class="btn1"
                     v-if="orderDetail.status>='1'&&orderDetail.status!='11'&&orderDetail.status!='10'&& orderDetail.status!='8'">
                  驳回
                </div>
                <div class="btn2" @click="$router.go(-1)">返回</div>
              </div>
            </div>
            <!--驳回的弹框-->
            <a-modal
              title="订单驳回"
              v-model:visible="visible0"
              @ok="delOrder"
            >
              驳回原因：
              <a-input v-model="jieRemark"/>
            </a-modal>
          </a-tab-pane>

          <a-tab-pane key="2" tab="订单状态跟踪" force-render>
            <div class="info">
              <h3 class="title">订单状态跟踪</h3>
              <div v-for="(item,key) in orderTrackingList" :key="item.id">
                <h4 class="title10">{{ item.createTime }}</h4>
                <div class="text10">
                  <p>订单状态:</p>
                  <div>
                    <span v-if="item.orderStatus==null">未支付</span>
                    <span v-if="item.orderStatus=='0'">未支付</span>
                    <span v-if="item.orderStatus=='1'">已支付</span>
                    <span v-if="item.orderStatus=='2'">申请售后</span>
                    <span v-if="item.orderStatus=='3'">已接单</span>
                    <span v-if="item.orderStatus=='4'">已发货</span>
                    <span v-if="item.orderStatus=='5'">已完成</span>
                    <span v-if="item.orderStatus=='6'">备库</span>
                    <span v-if="item.orderStatus=='7'">驳回</span>
                  </div>
                </div>
                <div class="text10">
                  <p>订单事件:</p>
                  <div>
                    <span>{{ item.thing }}</span>
                  </div>
                </div>

                <div class="text10">
                  <p>事件备注:</p>
                  <div>
                    <span>{{ item.remark }}</span>
                  </div>
                </div>

                <div class="text10" v-if="item.orderStatus=='4'">
                  <p>物流单号:</p>
                  <div>
                    <span>{{ item.logisticsSn }}</span>
                  </div>
                </div>
              </div>
            </div>
          </a-tab-pane>
          <a-tab-pane key="3" tab="产品状态更新">
            <div class="info">
              <h3 class="title">产品状态更新</h3>
              <a-form layout="inline">
                <a-form-item label="选择产品">
                  <a-select @change="listProductStatusFunc(updateProductID)" v-model="updateProductID"
                            style="width:250px" placeholder="请选择产品">
                    <a-select-option v-for="(item,key) in orderDetail.productInfoList" :value="item.id" :key="item.id"
                                     :label="item.productName">
                      {{ item.productName }}
                    </a-select-option>
                  </a-select>
                </a-form-item>

                <a-form-item label="选择状态">
                  <a-select v-model="updateProductStatus" style="width:250px" placeholder="请选择产品状态">
                    <a-select-option v-for="item in ProStstus" :value="item.dataname">
                      {{ item.dataname }}
                    </a-select-option>
                    <!--                    <a-select-option value="1">
                                          开始生产
                                        </a-select-option>
                                        <a-select-option value="2">
                                          剪裁布料
                                        </a-select-option>
                                        <a-select-option value="3">
                                          缝制
                                        </a-select-option>-->
                  </a-select>
                </a-form-item>

                <a-form-item label="生产流水号">
                  <a-input style="width:230px" v-model="wrater"></a-input>
                </a-form-item>

                <a-form-item label="备注信息">
                  <a-textarea :rows="4" style="width:300px" v-model="proRemark">
                  </a-textarea>
                </a-form-item>
                <br/>
                <br/>
                <br/>
                <a-form-item>
                  <a-button v-if="orderDetail.status!=10" @click="updateProductStatusFunc" type="primary">更新产品状态
                  </a-button>
                </a-form-item>

              </a-form>

              <h3 class="title">产品状态</h3>
              <!--表格化-->
              <el-table :stripe="true" :border="true" :data="productlistTracking">
                <el-table-column
                  align="center"
                  label="序号"
                  type="index"
                  width="50">
                </el-table-column>

                <el-table-column
                  :show-overflow-tooltip="true"
                  align="center"
                  prop="productName"
                  label="产品名称"
                >
                </el-table-column>

                <el-table-column
                  :show-overflow-tooltip="true"
                  align="center"
                  prop="statusName"
                  label="产品状态"
                >
                </el-table-column>

                <el-table-column
                  :show-overflow-tooltip="true"
                  align="center"
                  prop="createTime"
                  label="更新时间"
                >
                </el-table-column>

                <el-table-column
                  :show-overflow-tooltip="true"
                  align="center"
                  prop="remark"
                  label="备注信息"
                >
                </el-table-column>

                <el-table-column
                  :show-overflow-tooltip="true"
                  align="center"
                  prop="wrater"
                  label="业务流水号"
                >
                </el-table-column>
              </el-table>
              <!--              <div style="margin-top: 10px" v-for="(item,key) in productlistTracking" :key="item.id">
                              <h4 class="title10">{{ item.createTime }}</h4>
                              <div class="text11">
                                <p>产品名称:</p>
                                <div>
                                  <h5>{{ item.productName }}</h5>
                                  <p>时间：{{ item.createTime }}</p>
                                  <p v-show="item.statusName != null">产品状态：{{ item.statusName }}</p>
                                  <p v-show="item.status == 4">产品状态：售后</p>
                                  <p v-show="item.status == 5">运单号：{{ item.yunnumber }}</p>
                                  <p>备注信息：{{ item.remark }}</p>
                                  &lt;!&ndash;<p>备注信息：{{item.remark}}</p>&ndash;&gt;
                                </div>
                              </div>
                            </div>-->
            </div>
          </a-tab-pane>
          <a-tab-pane key="4" tab="售后记录跟踪">
            <div class="info">
              <h4 class="title1" style="font-weight: 700;width: auto;">售后订单列表</h4>
              <div class="table-css">
                <a-table class="table1" :row-selection="rowSelection" lign="center" :columns="afterTitle"
                         :loding="true"
                         :pagination="pagination"
                         @change="handleTableChange"
                         :data-source="afterlist">
                <span slot="k6" slot-scope="text,record">
                  <router-link
                    :to="{path:'/orderCenter/AfterSaleSingle',query:{id:record.id,pro:record.productId,afterCode:record.afterCode,orderSn:$route.query.order}}"
                    style="color:#C49D18">查看详情
                  </router-link>
                  <a-popconfirm style="margin-left: 8px" title="确定完结吗?"
                                @confirm="() => afterOK(record.id)">
                    <a style="color:#C49D18">完成售后</a>
                  </a-popconfirm>
                </span>

                </a-table>
              </div>
            </div>
          </a-tab-pane>

          <a-tab-pane key="5" tab="订单产品列表">
            <div class="info">
              <h4 class="title1" style="font-weight: 700;width: auto;">订单产品列表</h4>
              <div class="table-css">
                <a-table class="table1" :row-selection="rowSelection" lign="center" :columns="productList"
                         :loding="true"
                         :pagination="pagination"
                         @change="handleTableChange"
                         :data-source="producelistdata">
                <span slot="proAction" slot-scope="text, record">
                   <a
                     @click="$router.push({path:'/MyOrderSubsystem/CustomizesInfo',query:{product:record.id}})">查看详情</a>
                   <a v-show="orderDetail.status==1" style="margin-left: 8px;"
                      @click="openGYSwINDOW(record.id)">选择加工厂</a>
                </span>

                </a-table>
              </div>
            </div>
          </a-tab-pane>

          <!--干啥？选择供应商-->
          <a-modal
            title="选择加工厂"
            v-model:visible="visible2"
            @ok="selectgysFunc"
          >
            加工厂：
            <a-select
              ref="select"
              style="width: 186.76px"
              v-model:value="gysid"
              placeholder="请选择供应商"
            >
              <a-select-option :label="item.realname" :value="item.id" v-for="(item,key) in gyslist" :key="item.id">
                {{ item.realname }}
              </a-select-option>
            </a-select>
          </a-modal>

          <!--订单调价-->
          <a-modal
            title="订单调价"
            v-model:visible="visible"
            @ok="changPriceFunc"
          >
            <label>调价金额：</label>
            <a-input-number style="width: 50%" v-model="changePrice" :min="0"/>
            <br/>
            <br/>
            <lable>调价备注：</lable>
            <a-input style="width: 50%" v-model="tremark"/>
          </a-modal>
        </a-tabs>

      </div>

    </div>
  </a-card>
</template>

<script>
import {getAction, getFileAccessHttpUrl} from "../../api/manage";
// @ is an alias to /src
import locale from 'ant-design-vue/es/date-picker/locale/zh_CN';

// import {jquery} from '../../mixins/jquery'
// import {zoomjs} from '../../mixins/zoom'
// 收费服务项
const fuwuFabricTitle = [{
  title: '序号',
  dataIndex: '',
  key: 'rowIndex',
  align: 'center',
  customRender: function (t, r, index) {
    return parseInt(index) + 1
  }
},
  {
    title: '品类名称',
    align: "center",
    dataIndex: 'plname'
  },
  {
    title: '项目',
    align: "center",
    dataIndex: 'name'
  }, {
    title: '类型',
    align: "center",
    dataIndex: 'type'
  },
  {
    title: '金额',
    align: "center",
    dataIndex: 'price'
  },
];

// 这是订单的所有面料列表
const fabriclist = [
  {
    title: '序号',
    dataIndex: '',
    key: 'rowIndex',
    width: 60,
    align: 'center',
    customRender: function (t, r, index) {
      return parseInt(index) + 1
    }
  },
  {
    title: '面料',
    align: "center",
    dataIndex: 'fabricCode'
  },
  {
    title: '米数',
    align: "center",
    dataIndex: 'mishu'
  },
  {
    title: '标准单价',
    align: "center",
    dataIndex: 'fabricPrice'
  }, {
    title: '面料备注',
    align: "center",
    dataIndex: 'fabricRemark'
  },

  {
    title: '客户折扣',
    align: "center",
    dataIndex: 'kehuzk',
    customRender: function (text) {
      if (text == '1') {
        return '100%'
      } else {
        return (Number(text) * 100) + "%"
      }
    }
  },
  {
    title: '折后单价',
    align: "center",
    dataIndex: 'afterPrice'
  },
  {
    title: '总金额',
    align: "center",
    dataIndex: 'allPrice'
  },
];

// 加工费用列表
const allprolist = [
  {
    title: '序号',
    dataIndex: '',
    key: 'rowIndex',
    width: 60,
    align: 'center',
    customRender: function (t, r, index) {
      return parseInt(index) + 1
    }
  },
  {
    title: '产品名称',
    align: "center",
    dataIndex: 'productName'
  },
  {
    title: '品类',
    align: "center",
    dataIndex: 'pingleiName'
  },
  {
    title: '工艺类型',
    align: "center",
    dataIndex: 'gyname'
  },
  {
    title: '性别',
    align: "center",
    dataIndex: 'sex',
    customRender: function (text) {
      if (text == '0') {
        return '男'
      } else if (text == '1') {
        return '女'
      }
    }
  },
  {
    title: '标准单价',
    align: "center",
    dataIndex: 'zheqianPrice'
  },
  {
    title: '客户折扣',
    align: "center",
    dataIndex: 'khzk',
    customRender: function (text) {
      if (text == '1') {
        return '100%'
      } else {
        return (Number(text) * 100) + "%"
      }
    }
  },
  {
    title: '折后单价',
    align: "center",
    dataIndex: 'afterzhekouPrice'
  },
  {
    title: '总金额',
    align: "center",
    dataIndex: 'afterzhekouPrice'
  },
];

// 售后列表表头
const afterTitle = [
  {
    title: '序号',
    dataIndex: '',
    key: 'rowIndex',
    width: 60,
    align: 'center',
    customRender: function (t, r, index) {
      return parseInt(index) + 1
    }
  },
  {
    title: '售后单号',
    align: "center",
    dataIndex: 'afterCode'
  },
  {
    title: '更新时间',
    align: "center",
    dataIndex: 'createTime'
  },
  {
    title: '售后金额(元)',
    align: "center",
    dataIndex: 'afterPrice'
  },
  {
    title: '售后类型',
    align: "center",
    dataIndex: 'afterSalesType',
    customRender: function (text) {
      if (text == '0') {
        return '退货'
      } else if (text == '1') {
        return '换货'
      } else if (text == '2') {
        return '返修'
      } else if (text == '3') {
        return '重做'
      }
    }
  },
  {
    title: '状态',
    align: "center",
    dataIndex: 'afterstatus',
    customRender: function (text) {
      if (text == '0') {
        return '已提交'
      } else if (text == '1') {
        return '已驳回'
      } else if (text == '2') {
        return '售后中'
      } else if (text == '3') {
        return '已完成'
      } else if (text == '4') {
        return '已发货'
      } else if (text == '5') {
        return "平台已收货"
      }
    }
  },
  /*{
    title: '状态',
    align: "center",
    dataIndex: 'status'
  },*/
  {
    title: '操作',
    align: "center",
    scopedSlots: {
      customRender: 'k6'
    }
  }
];

// 加价列表表头
const jiajia = [
  {
    title: '序号',
    dataIndex: '',
    key: 'rowIndex',
    align: 'center',
    customRender: function (t, r, index) {
      return parseInt(index) + 1
    }
  },
  {
    title: '产品名称',
    align: "center",
    dataIndex: 'productName'
  },
  {
    title: '参数名称',
    align: "center",
    dataIndex: 'costName'
  },
  {
    title: '总金额',
    align: "center",
    dataIndex: 'price'
  },
];

// 订单产品列表表头
const productList = [
  {
    title: '序号',
    dataIndex: '',
    key: 'rowIndex',
    align: 'center',
    customRender: function (t, r, index) {
      return parseInt(index) + 1
    }
  },
  {
    title: '产品名称',
    align: "center",
    dataIndex: 'productName'
  },
  {
    title: '产品编号',
    align: "center",
    dataIndex: 'productCode'
  },
  {
    title: '产品数量',
    align: "center",
    dataIndex: 'numbers'
  },
  {
    title: '品类',
    align: "center",
    dataIndex: 'pingleiName'
  },
  {
    title: '加工厂',
    align: "center",
    dataIndex: 'gysName',
    customRender: function (text) {
      if (text == null) {
        return '未派'
      } else {
        return text
      }
    }
  },
  {
    title: '操作',
    align: "center",
    scopedSlots: {customRender: 'proAction'}
  },
]

export default {
  // name: 'MyAfterSales',
  data() {
    return {
      proRemark: '', // 更新产品状态备注
      wrater: '', // 流水号
      ProStstus: [], // 产品状态列表
      orderFujiaList: [], // 订单已选中附加条件列表
      shouFeiPrice: '', // 里布纽扣的价格
      fuwuFabricTitle, // 收费服务项表头
      shouFeiList: [], //里布、纽扣列表
      jieRemark: '', // 驳回的原因
      visible0: false, // 驳回的弹窗是否显示
      selectProid: '', // 选中的产品id
      producelistdata: [], // 产品列表
      jiajia,
      jiajiaList: [], // 加价列表
      changePrice: '',// 调价金额
      tremark: '',// 调价备注
      visible: false, // 调价弹框是否显示
      visible2: false, // 供应商弹框是否显示
      gyslist: [], // 查询到的供应商列表
      gysid: undefined, // 供应商ID
      allprolist,
      fabriclist,
      remark: '', // 备注
      orderTrackingList: [], // 订单跟踪列表
      updateProductStatus: undefined,// 更新产品状态
      updateProductID: undefined, // 要更新产品的ID
      url: {
        gysList: '/fabricCenter/selectGYS', // 供应商列表
        orderDetail: '/orderCenter/SingleOrderDetail', // 个订订单详情
        afterOK: '/orderCenter/afterOK', // 售后完成
        rejectedOrder: "/orderCenter/rejectedOrder", // 驳回
        selectGYS: "/orderCenter/selectGYS", // 产品选择供应商（更新产品的供应商）
        getOrderTracking: "/orderCenter/getFabricOrderTracking", // 订单状态跟踪
        listtrackingProduct: "/orderCenter/listtrackingProduct", // 产品状态跟踪
        listTeamAfter: '/orderCenter/listTeamAfter', // 售后订单列表
        pricing: "/orderCenter/pricing", // 订单调价
        orderNowSingle: '/orderCenter/orderNowSingle', // 个订立即接单
        updateProductStatus: '/orderCenter/updateProductStatus', // 更新产品状态
        listJiajia: '/fabricAndOther/listJiajia', // 查询所有加价服务
        productList: '/fabricAndOther/productList', // 订单下产品列表
        shouFeifuwuXiang: '/fabricAndOther/shouFeifuwuXiang', // 个订收费服务项的价格（里布、纽扣等的价格）
        listFujia: '/fabricAndOther/listFujia', // 订单附加条件列表
        listProductStatus: '/fabricAndOther/listProductStatus', // 获取产品状态
      },
      afterTitle,
      productList,
      afterlist: [], // 售后订单列表
      // 分页
      pagination: {
        current: '',
        total: 0,
        pageSize: 10,//每页中显示10条数据
      },
      orderDetail: {},// 个订订单详情
      productlistTracking: [],// 产品状态跟踪
      locale,
      selectedRowKeys: [],
      tab1Data: [{
        id: 1,
        name: '无需试穿'
      },
        {
          id: 2,
          name: '半成品试穿'
        },
        {
          id: 3,
          name: '毛坯半成品试穿'
        },
      ],
      tab1Idx: -1,
      tab2Data: [{
        id: 1,
        name: '常规',
        hoveName: '7个工作日'
      },
        {
          id: 2,
          name: '加急',
          hoveName: '5个工作日200元'
        },
        {
          id: 3,
          name: '特急',
          hoveName: '3个工作日400元'
        },
      ],
      tab2Idx: -1,
      tab3Data: [{
        id: 1,
        name: '来款/样式'
      },
        {
          id: 2,
          name: '改款'
        },
      ],
      tab3Idx: -1,
      tab4Data: [{
        id: 1,
        name: '派定制'
      },],
      tab4Idx: -1,
    }
  },
  computed: {
    rowSelection() {
      return {
        onChange: (selectedRowKeys, selectedRows) => {
          console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
        },
        getCheckboxProps: record => ({
          props: {
            disabled: record.name === 'Disabled User', // Column configuration not to be checked
            name: record.name,
          },
        }),
      };
    },
  },
  created() {
    this.listFujiaFunc()
    this.getorderDetail()
    this.getAfterList()
    this.Tracking()
    this.productTracking()
    this.listJiajiaFunc()
    this.productListFunc()
    this.getgys()
    this.shouFeifuwuXiangFunc()
  },
  methods: {

    /**
     * 下载
     */
    download(orderSn) {
      let url = getFileAccessHttpUrl(window._CONFIG['domianURL'] + "/fabricAndOther/dingleExcel?orderSn=" + orderSn)
      window.open(url);
    },

    /**
     * 获取产品状态
     * @param productId 产品id
     */
    listProductStatusFunc(productId) {
      getAction(this.url.listProductStatus, {'proid': productId}).then(res => {
        if (res.code == 200) {
          this.ProStstus = res.result
        }
      })
    },

    /**
     * 获取已经选择的附加条件
     */
    listFujiaFunc() {
      getAction(this.url.listFujia, {
        'orderSn': this.$route.query.order
      }).then(res => {
        if (res.code == 0) {
          this.orderFujiaList = res.data
        }
      })
    },

    /**
     * 获取里布价格列表
     */
    shouFeifuwuXiangFunc() {
      getAction(this.url.shouFeifuwuXiang, {
        'orderSn': this.$route.query.order
      }).then(res => {
        if (res.code == '0') {
          this.shouFeiList = res.data
          this.shouFeiPrice = res.price
        }
      })
    },

    /**
     * 售后完成
     */
    afterOK(id) {
      getAction(this.url.afterOK, {"id": id}).then(res => {
        if (res.code == '0') {
          this.getAfterList()
          this.$message.success("操作成功")
        } else {
          this.$message.success("操作失败")
        }
      })
    },

    /**
     * 打开驳回的弹窗
     */
    openDelWindow() {
      this.visible0 = true
    },
    /**
     * 给产品选择供应商
     */
    selectgysFunc() {
      getAction(this.url.selectGYS, {
        'proid': this.selectProid,
        'gysid': this.gysid
      }).then(res => {
        if (res.code == '0') {
          this.$message.success('操作成功')
          this.productListFunc()
        } else {
          this.$message.error('操作失败')
        }
        this.visible2 = false
      })
    },

    /**
     * 打开选择供应商的弹窗
     * @param proid 选中的产品id
     */
    openGYSwINDOW(proid) {
      this.selectProid = proid
      this.visible2 = true
    },

    // 获取供应商列表
    getgys() {
      getAction(this.url.gysList).then(res => {
        this.gyslist = res.result
      })
    },

    /**
     * 获取产品列表
     */
    productListFunc() {
      getAction(this.url.productList, {
        'orderSn': this.$route.query.order
      }).then(res => {
        if (res.code == '0') {
          this.producelistdata = res.data
        }
      })
    },

    /**
     * 获取加价服务列表
     */
    listJiajiaFunc() {
      getAction(this.url.listJiajia, {
        'orderSn': this.$route.query.order
      }).then(res => {
        if (res.code == '0') {
          this.jiajiaList = res.data
          // this.jiajiaMoney = res.data.allMoney
        } else {
          this.$message.error("查询失败")
        }
      })
    },

    /**
     * 更新产品状态
     */
    updateProductStatusFunc() {
      if (this.updateProductID == undefined || this.updateProductStatus == undefined) {
        this.$message.warning("信息未填写完整")
        return
      } else {
        getAction(this.url.updateProductStatus, {
          'productID': this.updateProductID,
          'orderSn': this.$route.query.order,
          'status': 0,
          'name': this.updateProductStatus,
          'remark': this.proRemark,
          'wrater': this.wrater
        }).then(res => {
          if (res.code == '0') {
            this.$message.success("操作成功")
            this.productTracking()
          } else {
            this.$message.error("操作失败")
          }
        })
      }
    },

    orderNow(orderSn) { // 个订订单立即接单
      getAction(this.url.orderNowSingle, {'orderSn': orderSn}).then(res => {
        if (res.code == '0') {
          this.$message.success("接单成功")
          this.$router.go(-1)
        } else {
          this.$message.error("订单不存在或已接单")
        }
        this.loadData()
      })
    },
    /**
     * 订单调价
     * @author zxl
     */
    changPriceFunc() {
      if (this.changePrice == '') {
        this.$message.error("请输入调价金额")
        return;
      } else {
        getAction(this.url.pricing, {
          'orderType': 0,
          'orderSn': this.orderDetail.orderSn,
          'price': this.changePrice,
          'remark': this.tremark
        }).then(res => {
          if (res.code == '200') {
            this.visible = false
            this.$message.success("调价成功")
            this.getorderDetail()
            this.Tracking()
          } else {
            this.$message.error("调价失败")
          }
        })
      }
    },

    //（驳回个订订单）
    delOrder() {
      getAction(this.url.rejectedOrder, {
        'orderType': 0,
        'orderID': this.orderDetail.id,
        'remark': this.jieRemark
      }).then(res => {
        if (res.code == '0') {
          this.$message.success("驳回成功")
          this.$router.go(-1)
        } else {
          this.$message.warning("驳回失败")
        }
      })
    },

    // 获取个订订单详情
    getorderDetail() {
      const loading = this.$loading({
        lock: true,
        text: '数据拼命加载中...',
        spinner: 'el-icon-loading',
        background: 'rgba(0, 0, 0, 0.7)'
      });
      getAction(this.url.orderDetail, {
        'orderSn': this.$route.query.order
      }).then(res => {
        loading.close();
        if (res.code == '0') {
          this.orderDetail = res.data
        }
      })
    },

    // 订单状态跟踪
    Tracking() {
      getAction(this.url.getOrderTracking, {
        'orderType': 0,
        'orderSn': this.$route.query.order
      }).then(res => {
        if (res.code == '0') {
          this.orderTrackingList = res.data
        }
      })
    },
    // 产品状态跟踪
    productTracking() {
      getAction(this.url.listtrackingProduct, {
        'orderSn': this.$route.query.order
      }).then(res => {
        if (res.code == '0') {
          this.productlistTracking = res.data
        }
      })
    },

    // 获取团订订单售后记录列表
    getAfterList() {
      getAction(this.url.listTeamAfter, {
        'orderSn': this.$route.query.order,
        'orderType': 0
      }).then(res => {
        if (res.code == '0') {
          this.afterlist = res.data.records
          this.pagination.total = res.data.total
          this.pagination.current = res.data.current
        }
      })
    },

    // 分页器方法
    handleTableChange(page, pageSize) {
      getAction(this.url.listTeamAfter, {
        'pageNo': page.current,
        'pageSize': page.current.pageSize,
        'orderSn': this.$route.query.order,
        'orderType': 0
      }).then(res => {
        if (res.code == '0') {
          this.afterlist = res.data.records
          this.pagination.total = res.data.total
          this.pagination.current = res.data.current
        }
      })
    },

    selectTab: function (dataStr, i) {
      this[dataStr] = i
    }
  }
}
</script>

<style scoped lang="less">
.roder-details {
  width: 100%;
  margin: 0 auto;
  background: #fff;
  margin-top: 20px;
  padding: 20px 35px;

  .info {
    padding-top: 30px;
    padding-left: 26px;
    position: relative;
    min-height: 800px;


    .text11 {
      display: flex;
      margin-bottom: 20px;

      & > p {
        width: 100px;
        font-weight: 100;
        font-size: 14px;
        color: #333;

      }

      div {
        h5 {
          color: #333;
          font-size: 15px;
          font-weight: 500;

          display: block;
        }

        p {
          color: #333;
          font-size: 15px;
          font-weight: 100;

          display: block;
        }
      }
    }

    .title10 {
      color: #333;
      font-weight: 700;
      font-size: 16px;
      line-height: 16px;
      margin-bottom: 20px;
    }

    .text10 {
      display: flex;
      margin-bottom: 20px;

      & > p {
        width: 100px;
        font-weight: 100;
        font-size: 14px;
        color: #333;

      }

      div {
        span {
          color: #333;
          font-size: 15px;
          font-weight: 100;

          &.b {
            font-weight: 500;
          }

          display: block;
        }
      }
    }

    .table-css {
      position: relative;

      .bz {
        width: 447px;
        height: 63px;
        background: inherit;
        background-color: rgba(255, 221, 202, 1);
        position: absolute;
        right: 0px;
        top: -63px;
        display: flex;
        align-items: center;
        justify-content: center;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        flex-direction: column;

        p {
          width: 100%;
          color: rgb(251, 8, 8);
          font-size: 13px;
          padding-left: 10px;
          margin-bottom: 0px;
          line-height: 16px;
        }
      }
    }

    .btns {
      margin-top: 25px;
      margin-bottom: 60px;
      display: flex;

      .btn1 {

        border-width: 0px;
        width: 105px;
        height: 42px;
        background: inherit;
        background-color: rgba(81, 81, 81, 1);
        border: none;
        border-radius: 3px;
        -moz-box-shadow: none;
        -webkit-box-shadow: none;
        box-shadow: none;
        font-family: 'PingFangSC-Medium', 'PingFang SC Medium', 'PingFang SC';
        font-weight: 500;
        font-style: normal;
        font-size: 13px;
        text-align: center;
        display: block;
        color: rgb(236, 227, 0);
        line-height: 40px;
        margin-right: 20px;
        cursor: pointer;
      }

      .btn2 {

        border-width: 0px;
        width: 105px;
        height: 42px;
        background: inherit;
        background-color: rgba(244, 244, 244, 1);
        border: none;
        border-radius: 3px;
        -moz-box-shadow: none;
        -webkit-box-shadow: none;
        box-shadow: none;
        font-family: 'PingFangSC-Medium', 'PingFang SC Medium', 'PingFang SC';
        font-weight: 500;
        font-style: normal;
        font-size: 13px;
        text-align: center;
        display: block;
        color: rgb(104, 104, 104);
        line-height: 40px;
        margin-right: 20px;
        cursor: pointer;
      }
    }


    .price {
      color: rgb(38, 38, 38);
      font-size: 16px;

      span {
        color: rgb(215, 1, 1);
      }

      margin: 35px 0px;
    }

    .text1 {
      width: 533px;
      height: 105px;
      padding: 3px 2px 3px 2px;
      font-family: 'ArialMT', 'Arial';
      font-weight: 400;
      font-style: normal;
      font-size: 13px;
      text-decoration: none;
      letter-spacing: normal;
      color: #000000;
      vertical-align: none;
      text-align: left;
      text-transform: none;
      background-color: #f9f9f9;
      border-color: transparent;
      resize: none;
      outline: none;
      padding: 10px;
    }

    .tabs {
      .tab {
        margin-bottom: 10px;
        display: flex;

        h5 {
          width: 112px;
          padding: 2px 2px 2px 24px;
          background-color: rgba(249, 249, 249, 1);
          font-size: 15px;
          color: #333;
          display: flex;
          height: 36px;
          align-items: center;
          margin: 0px !important;
          margin-right: 6px !important;
        }

        .tab-content {
          height: 36px;
          display: flex;

          p {
            border: 1px solid rgb(242, 242, 242);
            min-width: 100px;
            height: 36px;
            height: 36px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 15px;
            color: #333;
            font-size: 15px;
            margin-right: 6px;

            cursor: pointer;

            b {
              display: none;
              font-weight: 700;
            }

            &.active {
              color: rgb(255, 236, 112);
              font-weight: 700;
              background-color: rgb(74, 74, 74);
            }

            &:hover {
              b {
                display: block;
              }

              span {
                display: none;
              }
            }
          }
        }
      }
    }

    h3.title {
      height: 30px;
      line-height: 30px;
      position: relative;
      font-size: 16px;
      color: #333;
      font-weight: 700;
      margin-bottom: 25px;

      &:after {
        position: absolute;
        height: 100%;
        width: 5px;
        position: absolute;
        left: -25px;
        top: 0px;
        background-color: rgba(74, 74, 74, 1);
        content: "";
      }
    }

    .title2 {
      width: 112px;
      padding: 2px 2px 2px 24px;
      font-size: 15px;
      color: #333;
      display: flex;
      height: 36px;
      align-items: center;
      margin: 0px !important;
      margin-bottom: 10px !important;
    }

    .list {
      margin-bottom: 20px;

      .list-div {
        display: flex;
        flex-wrap: wrap;

        div {
          width: 33.3%;
          display: flex;
          height: 36px;
          align-items: center;

          p {
            width: 112px;
            padding: 2px 2px 2px 24px;
            background-color: rgba(249, 249, 249, 1);
            font-size: 15px;
            color: #333;
            display: flex;
            height: 36px;
            align-items: center;
            margin: 0px !important;
          }

          span {
            width: calc(100% - 112px);
            padding: 2px 2px 2px 24px;
            font-size: 15px;
            color: #333;
            display: flex;
            height: 36px;
            align-items: center;

            &.b {
              font-weight: 700;
            }
          }
        }
      }
    }
  }
}

//@import '../../mixins/zoom.css';
</style>
